//
//  CXShopFoodCell.m
//  Meituan_OC
//
//  Created by Tony on 2016/10/5.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CXShopFoodCell.h"

@implementation CXShopFoodCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 1. 设置字体大小和换行
        self.textLabel.font = [UIFont systemFontOfSize:13];
        
        self.textLabel.numberOfLines = 2;
        
        // 2. 设置背景颜色
        self.contentView.backgroundColor = [UIColor cz_colorWithHex:0xe8e8e8];
        
        // 3. 设置选中视图
        UIView *bgView = [[UIView alloc] init];
        bgView.backgroundColor = [UIColor whiteColor];
        
        self.selectedBackgroundView = bgView;
        
        // 4. 设置标识视图
        UIView *vLine = [[UIView alloc] init];
        vLine.backgroundColor = [UIColor yellowColor];
        
        [bgView addSubview:vLine];
        
        // vLine自动布局
        [vLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.centerY.equalTo(bgView);
            make.size.mas_offset(CGSizeMake(4, 33));
        }];
        
        // 5. 设置分割线 - 通过view的方式添加，但是效率比较低。
        UIView *vSepa = [[UIView alloc] init];
        vSepa.backgroundColor = [UIColor lightGrayColor];
        
        [self.contentView addSubview:vSepa];
        
        // 自动布局vSepa
        [vSepa mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.leading.width.equalTo(self.contentView);
            make.height.mas_offset(1 / [UIScreen cz_scale]);
        }];
    }
    return self;
}

@end
